Function.prototype.customApply = function (context, paramsArr) {
  context = context ?? globalThis;
  const onlyKey = Symbol('onlyKey');
  context[onlyKey] = this;
  const result = context[onlyKey](...paramsArr);
  delete context[onlyKey];
  return result;
};

function fn(name, age) {
  console.log(`${name},${this.sex},${age}`);
}
const obj = {
  sex: '男',
};
fn.customApply(obj, ['小明', 18]);
